Skip to content

Support PostgreSQL schema other than public (CFM-356) #136

Closed
wants to merge 1 commit into from

Conversation

skoranda
Copy link
Contributor

@skoranda skoranda commented Dec 1, 2023

No description provided.

@benno
Copy link
Contributor

benno commented Jan 20, 2024

It looks like Doctrine's approach is to solve this at the ORM layer and not the database abstraction layer, ie: the expectation is that you should pass in names of the form schema.table rather than just table if you want to use a schema.

We actually do exactly that in SchemaManager::processSchema for $tablePrefix, though we don't seem to support table prefixes now. This is probably the "right way to do it", in that it makes the full path to the table explicit (and IIRC is what Cake does?), and probably isn't too much work to add to SchemaManager.

Transmogrify also does the same thing (but ironically only for MySQL) by forcing the database name to be prefixed to avoid quoting issues. But there is this cryptic comment: While theoretically Postgres supports the same notation, it seems to cause more problems than it solves.

I'm a little hesitant to have two different ways (string concatenation and setting the default search path) to do the same thing (prefixing table names), so maybe we should make an effort to try string concatenation, and if that fails for whatever reason fall back to the search path as a Postgres specific solution.

@skoranda
Copy link
Contributor Author

Closing this PR and will open a new one that uses a different approach per Benn's comment above. See Jira CFM-356 for details.

@skoranda skoranda closed this Mar 14, 2024
Sign in to join this conversation on GitHub.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants